package spring.cloud.tasks.tasks_assign_manager.task_item_assign_event_handler;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import spring.cloud.tasks.tasks_assign_manager.service.TaskItemAssignService;
import spring.cloud.tasks.tasks_assign_manager.task_item_assign_event.NameSpaceTasksTaskItemAssignEvent;
import spring.cloud.tasks.tasks_assign_manager.task_item_assign_event.TaskItemAssignEvent;

@Slf4j
@Setter
@Getter
public class NameSpaceTasksTaskItemAssignEventHandler extends TaskItemAssignEventHandler {

    private TaskItemAssignService taskItemAssignService;

    public NameSpaceTasksTaskItemAssignEventHandler(TaskItemAssignService taskItemAssignService) {
        this.taskItemAssignService = taskItemAssignService;
    }

    @Override
    public void handle(TaskItemAssignEvent taskItemAssignEvent) throws Exception {
        if (taskItemAssignEvent instanceof NameSpaceTasksTaskItemAssignEvent) {
            taskItemAssignService.tasksFullAllot();
        }
    }


}
